<?php

namespace App\Http\Controllers\Labaicai;

use App\Models\Me;
use App\Models\MeArticle;
use App\User;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class UserController extends Controller
{

    public function show($id)
    {
        $result = User::query()->with(['roles'])->where('id', $id)->first();
        $result->roles()->detach();
        $result->roles()->attach([
            ['role_id' => 1],
            ['role_id' => 2],
            ['role_id' => 3],
        ]);

        return $result->toArray();
    }

    public function get($id)
    {
        $result = User::query()->with(['roles'])->where('id', $id)->first();
        return $result->toArray();
    }
}
